﻿<%@ Page Title="" Language="C#" MasterPageFile="~/NestedMasterPage.master" AutoEventWireup="true" CodeBehind="WebMyAddress.aspx.cs" Inherits="Web.WebMyAddress" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
      <p style="padding: 10px 0px 10px 0px;">
        <asp:SiteMapPath ID="SiteMapPath1" runat="server" CssClass="sitmap"
            Style="font-family: 幼圆; font-size: medium" Font-Names="Verdana" Font-Size="0.8em" PathSeparator=" > ">
            <PathSeparatorStyle Font-Bold="True" ForeColor="#990000" />
            <CurrentNodeStyle ForeColor="#333333" />
            <NodeStyle Font-Bold="True" />
            <RootNodeStyle Font-Bold="True" />
        </asp:SiteMapPath>
    </p>
    <link href="css/bootstrap.min.css" rel="stylesheet" />
    
    <div class="table-responsive">
        <table class="table">
            <caption>我的地址</caption>
            <a class="btn btn-danger" href="WebAddressEdit.aspx?Id=0" >添加</a>
            <thead>
                <tr>
                    <th>编号</th>
                    <th>地址</th>
 
                     <th >操作</th>
                </tr>
            </thead>
            <%if (list.Count > 0) {  %>
               <tbody>
                <%foreach (var item in list) %>
                <%{ %>
                <tr>
                    
                    <td><%=item.Id %></td>
                    <td><%=item.address_msg %></td>
                   <td ><button type="button" style="text-align:center" v="<%=item.Id %>"  class="btn-link" name="del" onclick="cks(this)">设为默认</button>
                     <a    class="btn-link" href="WebAddressEdit.aspx?Id="<%=item.Id %>"" >编辑</a>
                    <button type="button" style="text-align:center" v="<%=item.Id %>"  class="btn-link" name="del" onclick="del(this)">删除</button></td>
                </tr>
                <% } %>
            </tbody>
            
              <% } else { %>
              <tbody>
                  <tr>
                       <td colspan="5" style="text-align:center">暂时没有数据...</td>
                  </tr>
              </tbody>
           <% } %>
        </table>
    </div>  
    <script>
 
        function cks(ck) {
            var this_Id = $(ck).attr('v');
            $.ajax({
                type: 'post',
                url: '../Hanlder/AddressHandler.ashx?Method=changeAddress',
                data: { Id: this_Id },
                success: function (data) {
                    alert('操作成功');
                    location.reload();
                }
            });
        }
        function del(ck) {
            var this_Id = $(ck).attr('v');
            $.ajax({
                type: 'post',
                url: '../Hanlder/AddressHandler.ashx?Method=Del',
                data: { Id: this_Id },
                success: function (data) {
                    alert('删除成功');
                    location.reload();
                }
            });
        }
    </script>
</asp:Content>
